import Vue from 'vue'
import VueRouter from 'vue-router'
import Article from '@/views/article'
import Layout from '@/views/layout'
import City from '@/views/city.vue'
// 懒加载
const Real = () => import('@/views/real.vue')
const Myhome = () => import('@/views/myhome')
const Home = () => import('@/views/home.vue')
const Map = () => import('@/views/map.vue')
const Login = () => import('@/views/login.vue')
const Registe = () => import('@/views/registe.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    redirect: '/article',
    children: [
      { path: 'article', component: Article },
      { path: 'myhome', component: Myhome },
      { path: 'real', component: Real },
      { path: 'home', component: Home }
    ]
  },
  { path: '/city', component: City },
  { path: '/map', component: Map },
  { path: '/login', component: Login },
  { path: '/registe', component: Registe }
]

const router = new VueRouter({
  routes
})

export default router
